{include file="common/header"/}
<style>
    .layui-table-cell{
        height: 60px;
        line-height: 60px;
    }
    .layui-layer-content img{
        max-width: 500px;
        max-height: 700px;
        display: block;
        margin: 5px auto 25px;
    }
</style>
<div class="lemo-container">
    <div class="lemo-main">
        <div class="admin-main layui-anim layui-anim-upbit">
            <fieldset class="layui-elem-field layui-field-title">
                <legend>列表</legend>
                <blockquote class="layui-elem-quote">
                    <div class="lemo-table">
                        <div class="layui-inline">
                            <input type="text" name="server_num" id='server_num'  placeholder="请输入手机号" autocomplete="off" class="layui-input">
                        </div>
						<div class="layui-inline">
						    <input type="text" name="sku_name" id='sku_name'  placeholder="请输入权益名称" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-inline">
						    <input type="text" name="province" id='province'  placeholder="请输入省份" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-inline">
						    <input type="text" name="city" id='city'  placeholder="请输入城市" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-inline">
						    <input type="text" name="isp" id='isp'  placeholder="请输入运营商(联通、移动、电信)" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-inline">
						    <input type="text" name="addtime" id='addtime'  placeholder="请输入时间" autocomplete="off" class="layui-input">
						</div>
                        <a  href="javascript:;" class="layui-btn data-add-btn layui-btn-sm" lay-submit="" lay-filter="add" id="search1">
                            {:lang('search')}
                        </a>
                        <a  href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger reset" lay-filter="reset" id="reset">
                            重置
                        </a>
                    </div>
                </blockquote>
            </fieldset>
            <table class="layui-table" id="list" lay-filter="list"></table>
			<!--导出表 不展示-->
			<div style="display: none;">
				<table id="data_export">
				</table>
			</div>
        </div>
    </div>
</div>

<script type="text/html" id="createtime">
    {{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}
</script>
<script type="text/html" id="icon">
    <img class="img_sp" height="50px" src="{{d.icon}}" onclick="previewImgs(this)" />
</script>
{include file="common/footer"/}
<script>
    var tableIn;
    function previewImgs(obj) {
        var img = new Image();
        img.src = obj.src;
        var width = 550; //获取图片宽度
        var imgHtml = "<img src='" + obj.src + "' />";
        //弹出层
        layer.open({
            type: 1,
            shade: 0.8,
            offset: 'auto',
            area: [width + 'px'],
            shadeClose:true,//点击外围关闭弹窗
            scrollbar: false,//不现实滚动条
            title: "图片预览", //不显示标题
            content: imgHtml, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
            cancel: function () {
                //layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构', { time: 5000, icon: 6 });
            }
        });
    }
    layui.config({
        base: "/static/admin/js/",
        version: true
    }).extend({
        Admin: 'Admin'
    }).use(['element','form', 'layer', 'Admin','table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;
        tableIn = table.render({
            elem: '#list',
            url: '{:url("callback")}',
            method: 'post',
            cols: [[
                {checkbox: true, fixed: true},
                {field: 'id', title: 'ID', fixed: true, sort: true},
                {field: 'server_num', title: '手机号'},
                {field: 'order_no', title: '订单号', width: 230},
                {field: 'sku_id', title: '权益ID'},
                {field: 'sku_name', title: '权益名称', width: 230},
                {field: 'province', title: '省份'},
                {field: 'city', title: '城市'},
                {field: 'isp', title: '运营商'},
                {field: 'createtime',width:200, title: '添加时间'},
                // {title:'操作',width:200, toolbar: '#action',align:"center"},
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true
        });
        //搜索
        $(document).on('click','#search1',function(){
            var server_num = $('#server_num').val();
            var sku_name = $('#sku_name').val();
            var province = $('#province').val();
            var city = $('#city').val();
            var isp = $('#isp').val();
            var addtime = $('#addtime').val();
            // if(!$keys){
            //     return layer.msg('请输入关键词');
            // }
            tableIn.reload({ page: {page: 1},where: {server_num: server_num , sku_name: sku_name , province: province , city: city , isp: isp, addtime: addtime}});
        });
    });
</script>